/*  
 * Copyright (C) 2011 Marta Spodymek
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *  
 */
package org.prometheuscode.web.feedback.domain;

/**
 * Implements {@link IUser}.
 * 
 * @author marta
 * 
 */
public class User implements IUser {

    private String login;

    private String fullName;

    private String companyName;

    private String email;

    /*
     * Does the user object need set of feeds?
     */
    // private Set<IFeed> feeds;

    public User() {
    }

    public User(String login, String fullName, String companyName) {
	this.login = login;
	this.fullName = fullName;
	this.companyName = companyName;
    }

    /*
     * Setters and getters
     */

    public String getLogin() {
	return this.login;
    }

    public void setLogin(String login) {
	this.login = login;
    }

    public String getFullName() {
	return this.fullName;
    }

    public void setFullName(String fullName) {
	this.fullName = fullName;
    }

    public String getCompanyName() {
	return this.companyName;
    }

    public void setCompanyName(String companyName) {
	this.companyName = companyName;
    }

    @Override
    public String getEmail() {

	return this.email;
    }

    @Override
    public void setEmail(String email) {
	this.email = email;
    }

    /*
     * 
     * @Override public Set<IFeed> getFeeds() {
     * 
     * return this.feeds; }
     * 
     * 
     * @Override public void setFeeds(Set<IFeed> feeds) { this.feeds = feeds; }
     */

    @Override
    public boolean equals(Object obj) {
	if (obj == this) {
	    return true;
	}

	if (obj == null || !(IUser.class.isAssignableFrom(obj.getClass()))) {
	    return false;
	}

	IUser user = (IUser) obj;

	return (this.login.equals(user.getLogin()));

    }

    @Override
    public final int hashCode() {
	return this.login.hashCode();

    }

}
